package com.graduate.cec.service;


import com.graduate.cec.common.ResponseCode;
import com.graduate.cec.exception.CecServiceException;
import com.graduate.cec.mapper.AdminRoleMapper;
import com.graduate.cec.pojo.entity.AdminRole;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
@Slf4j
public class AdminRoleService {
    @Resource
    AdminRoleMapper adminRoleMapper;



    public void insertRegister(Long adminId){
        AdminRole adminRole = new AdminRole();
        adminRole.setAdminId(adminId);
        adminRole.setRoleId(2L);
        int i = adminRoleMapper.insertSelective(adminRole);
        if (i == 0){
            throw new CecServiceException(ResponseCode.INSERT_INFO_ERROR,"插入关系表失败!");
        }
    }
}
